package com.hk.commons.poi.excel.read.sax.v03.handler;

import com.hk.commons.poi.excel.read.sax.v03.XlsReadContext;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.StringRecord;

/**
 * 存储文本公式的缓存结果
 *
 * @author Kevin
 */
public class StringRecordHandler implements XlsRecordHandler {

    @Override
    public void processRecord(Record poiRecord, XlsReadContext readContext) {
        if (readContext.isOutputNextStringRecord()) {
            StringRecord stringRecord = (StringRecord) poiRecord;
            readContext.setOutputNextStringRecord(false);
            readContext.getColumnValueMap().put(readContext.getNextColumn(), stringRecord.getString());
        }
    }
}
